﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Xml.Linq;

namespace OntologyWPFSilverlight.Widget
{
    public class Listbox : Canvas
    {
        private System.Windows.Controls.ListBox myListBox = null;
        private TextBlock label = null;
 
        public Listbox()
        {
            Build();
            
        }

        

        private void Build()
        {
            StackPanel stackpanel = new StackPanel();
            myListBox = new System.Windows.Controls.ListBox();
            label = new TextBlock();
            stackpanel.Children.Add(label);
            stackpanel.Children.Add(myListBox);
            
            this.Children.Add(stackpanel);
           
        }




        public void AddItem(IEnumerable<XElement> nodes)
        {
            foreach (XElement node in nodes)
            {
                myListBox.Items.Add(node.Attribute("Name").Value);
            }
        }

        public void AddLabel(string text)
        {
            label.Text = text;
        }

    
    }
}
